package com.liyunc.demo.bundle.security.service;


import com.liyunc.demo.comp.auth.AuthenticatedUser;
import com.liyunc.demo.comp.auth.Authenticator;
import lombok.RequiredArgsConstructor;
import org.apache.logging.log4j.util.Strings;

/**
 * @author liyuncong
 * @version 1.0
 * @file AuthenticatorService.java
 * @brief AuthenticatorService
 * @details AuthenticatorService
 * @date 2022-03-31
 *
 * Edit History
 * ----------------------------------------------------------------------------
 * DATE                        NAME               DESCRIPTION
 * 2022-03-31                  liyuncong          Created
 */
@RequiredArgsConstructor
public class AuthenticatorService<T> implements Authenticator<T> {
    @Override
    public AuthenticatedUser<T> authenticate(String username, String password) {
        if (Strings.isNotBlank(username) && Strings.isNotBlank(password)) {
            return new AuthenticatedUser<T>(username, username, username);
        }
        return null;
    }
}
